package com.johnburrin.mortgage.estimator;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ImageButton;

public class MainActivity extends Activity {
	ImageButton btnCloseMenuButton, btnCalculatorMenuButton = null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btnCalculatorMenuButton = (ImageButton) findViewById(R.id.imageButtonCalculator);
        btnCalculatorMenuButton.setOnClickListener(onClickHandler);
        btnCloseMenuButton = (ImageButton) findViewById(R.id.imageButtonClose);
        btnCloseMenuButton.setOnClickListener(onClickHandler);
        btnCloseMenuButton = (ImageButton) findViewById(R.id.imageButtonAffordability);
        btnCloseMenuButton.setOnClickListener(onClickHandler);
    }

	View.OnClickListener onClickHandler = new View.OnClickListener() {
		public void onClick(View v) {
			// TODO Use this for all click events
			switch (v.getId()){
			case R.id.imageButtonCalculator : 
				Intent mortgageCalculatorIntent = new Intent(v.getContext(), MortgageCalculatorActivity.class);
				startActivity(mortgageCalculatorIntent);				
				break;
				
			case R.id.imageButtonAffordability : 
				Intent affordabilityIntent = new Intent(v.getContext(), AfffordabilityActivity.class);
				startActivity(affordabilityIntent);				
				break;				
				
			case R.id.imageButtonClose:
				finish();
				break;
			}
		}

	};
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}
